package com.mode.mediator.pattern;

/**
 * @Description:
 * @Author: zyf
 * @Time: 2020/9/27 15:52
 */
public class ConcreteMediator extends Mediator{


    @Override
    public void getCompantion(Person person) {
        if(person instanceof Man){
            this.setMan((Man)person);

        }else {
            this.setWomen((Women)person);
        }

        if(this.getMan() == null || this.getWomen() ==null){
            System.out.printf("同性不能相亲");
        }else {
            if(this.getMan().getCondition() == this.getWomen().getCondition()){
                System.out.printf("你们结婚吧！");

            }else {
                System.out.printf("不合适啊");
            }
        }
        this.setMan(null);
        this.setWomen(null);
    }
}
